home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
F1 Licenseware
/
F1 Licenseware - Volume 1.iso
/
disks
/
003.dms
/
003.adf
/
TEXT
/
chapter13.txt
< prev
next >
Wrap
Text File
|
1992-09-02
|
7KB
|
194 lines
The Absolute Beginners Guide To Amos
-------------------------------------
Chapter thirteen
----------------
In this chapter, as promised earlier, we take a look at customizing our own
screens. But first the answers to self test quiz number 3:
1. A 6. C
2. B 7. C
3. C 8. C
4. A 9. A
5. C 10. C
---------------------------------------------------------------------------
EXAMPLE13.Amos is a small demonstration of opening screens of different
sizes, colours and resolutions, why would we want to do that? Well let us
say you were writing a word processor program. If you were to use Amos`s
default screen of 40 characters across it would look pretty shoddy against
a nice 80 column text display which is very easy to set up. There are many
more uses which I do not want to go into yet to save you confusion. Let us
get on with the SCREEN OPEN command.
SCREEN OPEN 0,320,200,16,lowres
The above line simulates the Amos default screen we have been using in all
of our example programs so far.
The 0 is just an I.D number so you can keep track of your screens if you
have more than one screen open at a time. You can have up to eight screens
open at once numbered 0-7.
The 320 is the width in pixels of our requested screen, if we changed this to
say 160 only half of our T.V screen would be used by our program (left half)
There is no real limit to the width of our screen, but for now we are best
off to stick to a maximum of 320 in lowres and 640 in hires.
The 16 is the number of colours we wish to be available to us, remember the
more colours you employ the more memory you use and a possibility of slowing
some programs down. As a rule most people tend to use 4,8,16 or 32 colours
for their screens. There are some limits to the amount of colours you can
use in hires but I would advise a maximum of eight.
LOWRES: There are only two options here LOWRES and HIRES, rather than explain
the difference again take a look at EXAMPLE13.Amos and you will understand.
That is Amos`s default screen that we use, here are the custom screens used
in EXAMPLE13.Amos
SCREEN OPEN 0,250,80,4,lowres
-----------------------------
Screen I.D = 0
Width = 250 pixels across
height = 80 pixels top to bottom
Colours = 4, using 0 to 3
Mode = Lowres
SCREEN OPEN 0,640,256,8,hires
-----------------------------
Screen I.D = 0
Width = 640 pixels across
height = 256 pixels top to bottom
Colours = 8, using 0 to 7
Mode = Hires (80 column text, 0-79)
Make notes of the five attributes of SCREEN OPEN for future reference and you
won`t go far wrong. Experiment with EXAMPLE13.Amos and see what weird and
wonderful screens you can come up with.
SCREEN DISPLAY
==============
Take a look at EXAMPLE13_1.Amos for a demonstration of how SCREEN DISPLAY
works.
This command allows us to position a previously defined screen to anywhere on
the TV display. This is the syntax of the command.
SCREEN DISPLAY N,X,Y,W,H
--------------------------
don`t be put off yet because it looks odd, I will break this down for you.
N
---
is the number of the screen you wish to position. Say for example we had
two screens open, 0 and 1, and we want to position screen 1 then we would put
a 1 here.
X
---
X is the position across the screen, but this time just to confuse us the
positioning isn`t in pixels or characters but in hardware coordinates.
For the moment don`t worry about why just remember that your X must be in the
range 112 to 448, 112 being the left edge of the screen.
Y
---
Y is of course in hardware coordinates. This tells SCREEN DISPLAY how far
down the display we want to position our new screen. The limits here are
0 to 312, with 0 being the top of the T.V screen.
W,H
---
Width, Height, we can leave these out luckily because SCREEN DISPLAY will
use the Width and Height of our previously opened custom screen so all we
need in W and Hs place are two commas like this ,,
In EXAMPLE13_2 A new command appears this the SCREEN command and instructs
Amos as to which screen we want to use if we have more than one screen open.
For example if we did
SCREEN OPEN 0,228,80,4,lowres
SCREEN OPEN 1,150,100,8,lowres
Amos would now use screen one as the current screen so if for example we
did PRINT "HELLO" the words HELLO would appear in screen 1.
This is where the SCREEN command comes in, what if we wanted the words HELLO
printed on screen 0? Well we just issue the command,
SCREEN 0
And Amos is now using SCREEN 0 as the current screen. EXAMPLE13_2.Amos will
make things very clear.
EXAMPLE13_2.Amos Is a neat compact program that performs an amazingly smooth
hardware scroll using another screen command called SCREEN OFFSET.
HIDE: UNPACK 10 TO 0: WAIT VBL
FOR A=1 TO 640
SCREEN OFFSET 0,A,0
WAIT VBL: NEXT A
Yep that`s all it is, prepare for breakdown.
HIDE: UNPACK 10 TO 0: WAIT VBL
------------------------------
We know all of these commands, EXAMPLE13_3.Amos contains a SPACKed picture in
bank 10. UNPACK the picture to screen 0 and WAIT for a screen refresh just
in case.
FOR A=1 to 640
--------------
Remember FOR NEXT? This takes the variable A and gives it the value of 1 to
start with and on each loop executes the commands between FOR and NEXT and
adds one to As value until it reaches 640 when the FOR NEXT loop will end
and the program will continue.
SCREEN OFFSET 0,A,0
-------------------
This is where it all happens the first 0 is the screen you wish to operate on
the A is our variable from the FOR NEXT loop which is constantly changing
as this is what is supposed to be the X coordinate of the screen it will make
the screen move (scroll) the other 0 is the y offset of the screen which we
leave unchanged for this example.
WAIT VBL: NEXT A
----------------
Delete the WAIT VBL from this line (leave the NEXT A in though) and you will
see why it is needed.
So to recap SCREEN OFFSET screen number,x offset,y offset
This instruction has many uses and lots of different and startling effects
can be achieved with it, but this is as far as we will go for now with screen
commands as we have begun to stretch the limits of a beginners course in
Amos.
Here are a few more SCREEN related commands that are easy to use that you
may want to investigate further.
SCREEN HIDE : Literally HIDE a screen from the users view.
SCREEN SHOW : Bring the hidden screen back
H=SCREEN HEIGHT : H returns the height of the current screen
W=SCREEN WIDTH : W returns width
C=SCREEN COLOUR : C returns amount of colours used by current screen
SCREEN CLOSE N : Deletes SCREEN number N and frees up the memory it used
End of chapter thirteen.